package cn.shyouchi.wuguanjia.android.ui.event.checknum;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/11/18 at 16:29
 * Email: 472279981@qq.com
 * Des:
 */

public class CheckNumAdapter extends BaseQuickAdapter<CheckNumEntity.ResultMessageBean,BaseViewHolder> {
    CheckNumContract.View mView;

    public CheckNumAdapter(List<CheckNumEntity.ResultMessageBean> data, CheckNumContract.View view) {

        super(R.layout.item_event_check_num, data);
        this.mView = view;
    }

    @Override
    protected void convert(BaseViewHolder holder, final CheckNumEntity.ResultMessageBean entity) {

        holder.setText(R.id.tv_check_num_name, String.format("共%d个巡检点", entity.getInfo().size()));
        holder.setText(R.id.tv_check_num, String.valueOf(holder.getAdapterPosition() + 1));

        holder.getView(R.id.item_layout).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onItemClick(entity);
            }
        });
        holder.getView(R.id.btn_del).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onDelClick(entity);
            }
        });

    }
}
